<html>
<head>
<h1>Edit Selected Account</h1>
</head>
<body>
<?php
	require "configcmd.php";	
	$ID = $_POST['ID'];
	$con = mysql_connect("localhost",$db_user ,$db_pass);

	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	mysql_select_db($db_name, $con);

	$sql_accounts = "Select * from accounts where ID = ".$ID.";";

	$result = mysql_query($sql_accounts);
	while($row = mysql_fetch_array($result))
	{
		echo "<form action='editaccountresult.php' method='GET'>";
		echo "Edit account with ID = ".$row['ID']."<br/>";
		echo "<input type='hidden' name = 'ID' value='".$row['ID']."'/> ";

		echo "Balance: <input type='text' name = 'Balance' value='".$row['Balance']."'/> <br/>";
		echo "Bal_limit: <input type='text' name = 'Bal_limit' value='".$row['Bal_limit']."'/> <br/>";
		echo "Status: <input type='text' name = 'Status' value='".$row['Status']."'/> <br/>";


		echo "<input type='submit' name = 'create' value='Edit'/>";
		echo "</form>";
	}
	mysql_close($con);
?>
</body>
<br />
<a href="main.php">Home</a>
<a href="showaccounts.php">View Accounts</a>
</html>
